package com.kuaidi.zhangke.kuaidi;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TwoActivity extends AppCompatActivity {

    @BindView(R.id.two_txt_phone)
    EditText twoTxtPhone;
    @BindView(R.id.two_btn_post)
    Button twoBtnPost;
    @BindView(R.id.two_btn_cancle)
    Button twoBtnCancle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_two);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.two_btn_post, R.id.two_btn_cancle})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.two_btn_post:
                String  phone =twoTxtPhone.getText().toString();

                if(phone.isEmpty()){
                    Toast.makeText(TwoActivity.this,"请输入手机号",Toast.LENGTH_SHORT).show();

                }else  if(phone.length()<11||phone.length()>11){
                    Toast.makeText(TwoActivity.this,"手机位数错误",Toast.LENGTH_SHORT).show();
                }else {
                    Intent intent =new Intent(TwoActivity.this,ThreeActivity.class);
                    startActivity(intent);
                    finish();

                }


                break;
            case R.id.two_btn_cancle:
                break;
        }
    }
}
